package com.newsee.remote.task;

import com.newsee.remote.idm.service.ISystemDepartmentThirdService;
import com.newsee.remote.idm.service.ISystemUsersThirdService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author liangzhi.chen
 * @description idm人员、组织增量同步接口
 * @date 2019/7/25 下午 05:42
 **/
@Component
public class IDMTask {

    private final ISystemUsersThirdService iSystemUsersThirdService;

    private final ISystemDepartmentThirdService iSystemDepartmentThirdService;

    public IDMTask(ISystemUsersThirdService iSystemUsersThirdService, ISystemDepartmentThirdService iSystemDepartmentThirdService) {
        this.iSystemUsersThirdService = iSystemUsersThirdService;
        this.iSystemDepartmentThirdService = iSystemDepartmentThirdService;
    }

    /**
     * 每天0点开始同步人员和组织
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void sync() {
        iSystemUsersThirdService.sunacUser(null,null);
        iSystemDepartmentThirdService.sunacOrg(null,null);
    }

}
